import 'package:xws/helpers/as_t.dart';

/// 位置信息
class LocObj {
  const LocObj({
    this.callbackTime,
    this.locationTime,
    this.locationType,
    this.latitude,
    this.longitude,
    this.accuracy,
    this.altitude,
    this.bearing,
    this.speed,
    this.country,
    this.province,
    this.city,
    this.district,
    this.street,
    this.streetNumber,
    this.cityCode,
    this.adCode,
    this.address,
    this.description,
  });

  factory LocObj.fromJson(Map<String, dynamic> jsonRes) => LocObj(
        callbackTime: asT<String>(jsonRes['callbackTime']),
        locationTime: asT<String>(jsonRes['locationTime']),
        locationType: asT<int>(jsonRes['locationType']),
        latitude: asT<double>(jsonRes['latitude']),
        longitude: asT<double>(jsonRes['longitude']),
        accuracy: asT<double>(jsonRes['accuracy']),
        altitude: asT<double>(jsonRes['altitude']),
        bearing: asT<double>(jsonRes['bearing']),
        speed: asT<double>(jsonRes['speed']),
        country: asT<String>(jsonRes['country']),
        province: asT<String>(jsonRes['province']),
        city: asT<String>(jsonRes['city']),
        district: asT<String>(jsonRes['district']),
        street: asT<String>(jsonRes['street']),
        streetNumber: asT<String>(jsonRes['streetNumber']),
        cityCode: asT<String>(jsonRes['cityCode']),
        adCode: asT<String>(jsonRes['adCode']),
        address: asT<String>(jsonRes['address']),
        description: asT<String>(jsonRes['description']),
      );

  final String? callbackTime;
  final String? locationTime;
  final int? locationType;
  final double? latitude;
  final double? longitude;
  final double? accuracy;
  final double? altitude;
  final double? bearing;
  final double? speed;
  final String? country;
  final String? province;
  final String? city;
  final String? district;
  final String? street;
  final String? streetNumber;
  final String? cityCode;
  final String? adCode;
  final String? address;
  final String? description;
}
